Virtual memory has long been known for use with mainframe computers and minicomputers. Virtual memory basically refers to a technique for combining a quantity of physical memory, typically provided by semiconductor chips such as DRAM, with a block of peripheral storage, which has in the past usually been magnetic media-based storage such as a hard disk, to give to the computer user the impression that the amount of physical RAM is actually larger than the available physical RAM.
The advantages of such techniques are well known in the art. Certain of these advantages are particularly noteworthy at present, including the substantial cost and relative unavailability of DRAM memory as compared to hard disk memory, as well as nominal space and power requirements, and nonvolatility.
A variety of virtual memory algorithms are known. Most use a memory management unit of some sort which maps a memory address in the virtual address space either to physical RAM or to the peripheral storage. One such algorithm is referred to as "paging", in which the virtual address space is divided into pages, and pages of information are swapped between the physical RAM and the peripheral storage. Various algorithms also exist for determining when best to make such a page swap. One common approach is to swap pages on demand.
Shown in FIG. 1a is a simplified prior art implementation of virtual memory. As can be seen, when the system detects an attempted access to a location of memory not resident in physical RAM, it saves the state of the processor on the stack, swaps in the page of virtual memory containing the necessary information, retrieves from the stack the state of the processor, and proceeds to execute the instruction that accessed the virtual space.
Although such virtual memory techniques are well known, such techniques generally have not been applied in the microcomputer-based, personal computer environment. Thus, for example, virtual memory has not been used in the Apple Macintosh/Macintosh SE/ Macintosh II environment with the Macintosh operating system. These environments may, in general, be thought of as Motorola 68XXX-based microcomputers using the Apple Macintosh operating system. Other operating systems offered by Apple, for example A/UX, and certain other manufacturers, such as Sun Microsystems, for example, use different operating systems, for example UNIX, with the same classes of microprocessors and offer virtual memory in such different environments.
The Motorola 680X0 series of microprocessors are designed to have two modes of operation, usually referred to as supervisor mode and user mode. To implement virtual memory, user programs generally are not permitted to operate with the 680X0 microprocessor in supervisor mode. Instead, only the operating system and operating system calls may run the processor in supervisor mode, while user programs operate only in user mode.
A difficulty arises with the Apple Macintosh series of personal computers using 680X0 microprocessors, because the Macintosh operating system permits user programs to operate the 680X0 processor in supervisor mode. A key difficulty which results is that the user programs for the Macintosh computer, operating with the 680X0 processor in supervisor mode, may change the location of the supervisor stack. FIG. 1b is a simplified block diagram of the arrangement of physical memory in a conventional Apple Macintosh computer, showing the operating system zone at the lowest addresses in memory, followed by a zone of memory for application programs. Above the zone for application programs is a stack zone, which in conventional Apple Macintosh computers is a supervisor-mode stack zone. Finally, at the top of memory is a zone referred to as static memory, where application programs can reserve a specific portion of memory to store needed information, and the information in those addresses generally cannot be moved by other programs until the system is rebooted.
Since most, if not all, virtual memory systems save the state of thprocessor to a stack, permitting the user program to alter the location of the supervisor stack while at the same time trying to run virtual memory may mean that the supervisor stack is moved, by the user program in supervisor mode, to a location which the virtual memory system already has swapped out to disk. When an attempt is later made to save the processor state on the stack, the state of the processor is effectively lost, resulting in a fatal error.
Thus, while the Macintosh operating system has many attractive features, including a popular graphics capability and user-friendly interface, the limitations of the Apple Macintosh operating system have posed significant problems for users desiring more memory and the associated performance improvements. Thus, there has been a significant need for a virtual memory system which is transparent to the normal user of the Apple Macintosh operating system with Apple Macintosh computers using the 680X0 processor.